package cn.yitun.chat.yitunservermanagecore.general.manage.chart.controller;

import cn.yitun.chat.yituncommonmessage.result.ResultMessage;
import cn.yitun.chat.yitungeneral.annotation.parameter.JsonDefine;
import cn.yitun.chat.yitungeneral.annotation.parameter.RequestParameter;
import cn.yitun.chat.yitunservercommonlib.crud.yitun.BaseController;
import cn.yitun.chat.yitunservercommonlib.dataentity.dto.chart.ChartBodyDto;
import cn.yitun.chat.yitunservermanagecore.general.bridge.auth.annotation.PermissionMapping;
import cn.yitun.chat.yitunservermanagecore.general.manage.chart.service.ChartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping(value = "/manage/chart")
@RestController
public class ChartController extends BaseController {


    @Autowired
    private ChartService chartService;

    @RequestParameter
    @PermissionMapping(name = "线状图", perms = "sys:chart:lineChartData")
    @PostMapping("/lineChartData")
    public Object lineChartData(@JsonDefine ChartBodyDto chartBobyDto){
        ResultMessage rm = new ResultMessage();
        rm.bodyPut("data", chartService.lineChartData(chartBobyDto));
        return rm;
    }

}
